home *** CD-ROM | disk | FTP | other *** search
/ TopWare Megapack 5 / CD des Monats August - 94 Topware.iso / august94 / top3023 / setup.mst < prev    next >
Text File  |  1994-03-14  |  6KB  |  191 lines

  1. '$DEFINE DEBUG  ''Define for script development/debugging
  2.  
  3. '$INCLUDE 'setupapi.inc'
  4. '$INCLUDE 'msdetect.inc'
  5.  
  6. '' This lets us add progman items
  7.  
  8. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  9. DECLARE FUNCTION UpdateAutoExec LIB "Setup.dll" (PATH$) AS INTEGER
  10. DECLARE FUNCTION IsGroupEaseRunning LIB "Setup.dll" AS INTEGER
  11.  
  12. ''Dialog ID's
  13. CONST ASKQUIT       = 200
  14. CONST DESTPATH      = 300
  15. CONST EXITFAILURE   = 400
  16. CONST EXITQUIT      = 600
  17. CONST EXITSUCCESS   = 700
  18. CONST EXITSUCCESSRB = 701
  19. CONST APPHELP       = 900
  20. CONST MODELESS      = 5000
  21. CONST BADPATH       = 6400
  22.  
  23.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  24.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  25.  
  26.     '' Display the logo bitmap
  27.     SetBitmap CUIDLL$, 1
  28.  
  29.     '' read the .INF file
  30.     szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  31.     ReadInfFile szInf$
  32.  
  33.     '' Make sure the GroupEase is not running first 
  34.     i%=IsGroupEaseRunning()
  35.     IF i% <> 0 THEN
  36.       i% = DoMsgBox ("GroupEase must not be running during Setup.  Please exit GroupEase then restart Setup.", "Setup", 0)
  37.       END
  38.     END IF
  39.  
  40.     '' query user for location to install to
  41.     DEST$="c:\ge"   ''default destination
  42.  
  43. GETPATH:
  44.     SetSymbolValue "EditTextIn", DEST$
  45.     SetSymbolValue "EditFocus", "END"
  46. GETPATHL1:
  47.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  48.     DEST$ = GetSymbolValue("EditTextOut")
  49.  
  50.     IF sz$ = "CONTINUE" THEN
  51.         IF IsDirWritable(DEST$) = 0 THEN
  52.             GOSUB BADPATH
  53.             GOTO GETPATHL1
  54.         END IF
  55.         UIPop 1
  56.     ELSEIF sz$ = "REACTIVATE" THEN
  57.         GOTO GETPATHL1
  58.     ELSEIF sz$ = "BACK" THEN
  59.         GOTO GETPATHL1
  60.     ELSE
  61.         GOSUB ASKQUIT
  62.         GOTO GETPATH
  63.     END IF
  64.  
  65.  
  66.  
  67.     '' specify which files from .INF file should get copied
  68.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  69.  
  70.     '' Get the application GroupEase and associated stuff
  71.     AddSectionFilesToCopyList "GroupEase", SrcDir$, DEST$
  72.  
  73.     '' Make sure there is available disk space
  74.     '' First param is just left as "extra", because we are not
  75.     '' expanding any existing files (i.e. adding a K or two to the 
  76.     '' WIN.INI file. If you use this, add an "Extra" symbol to
  77.     '' the symbol table created by AddListitem.
  78.     '' Second Parameter identifies a symbol table that the
  79.     '' GetCopyListCost function will create for how much space
  80.     '' is used by the files to be copied to hard disk.
  81.     '' Third Parameter identifies a symbol table that the
  82.     '' GetCopyListCost function will create to identify needed
  83.     '' disk space.
  84.  
  85.     lRetVal& = GetCopyListCost ( "Extra", "FileCost", "Needed" )
  86.  
  87.     IF lRetVal& > 0 THEN
  88.       i% = DoMsgBox ("Insufficient Disk Space", "Setup", 0 )
  89.       ClearCopyList
  90.       GOTO GETPATH '' Try another directory
  91.     END IF
  92.  
  93.     AddToBillboardList CUIDLL$, MODELESS, "FModelessDlgProc", 1
  94.  
  95.     SetCopyGaugePosition 100, 100
  96.  
  97.     '' copy the files
  98.     CopyFilesInCopyList
  99.  
  100.     '' Get the .INI files
  101.     AddSectionFilesToCopyList "INIs", SrcDir$, GetWindowsDir()
  102.     SetCopyGaugePosition 100, 100
  103.     CopyFilesInCopyList
  104.  
  105.     '' create a progman group
  106.     CreateProgmanGroup "Ethosoft", "", cmoNone
  107.     ShowProgmanGroup  "Ethosoft", 1, cmoNone
  108.     CreateProgmanItem "Ethosoft", "GroupEase", MakePath(DEST$,"ge.exe"), "", cmoOverwrite
  109.  
  110.     '' add our directory to the path if it is not already there
  111.     '' note: return values:
  112.     '' < 0 means error trying
  113.     '' = 0 means path added to autoexec.bat
  114.     '' > 0 means path already had ours in it
  115.     i%=UpdateAutoExec(DEST$)
  116.     IF i% < 0 THEN
  117.       ERR=i%
  118.     ENDIF
  119.  
  120. QUIT:
  121.     ON ERROR GOTO ERRQUIT
  122.  
  123.     IF ERR = 0 THEN
  124.         IF i% = 0 THEN
  125.           dlg% = EXITSUCCESSRB
  126.         ELSE
  127.           dlg% = EXITSUCCESS
  128.         ENDIF
  129.     ELSEIF ERR = STFQUIT THEN
  130.         dlg% = EXITQUIT
  131.     ELSE
  132.         dlg% = EXITFAILURE
  133.     END IF
  134. QUITL1:
  135.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  136.     IF sz$ = "REACTIVATE" THEN
  137.         GOTO QUITL1
  138.     END IF
  139.     UIPop 1
  140.  
  141.     END
  142.  
  143. ERRQUIT:
  144.     i% = DoMsgBox("Setup sources were corrupted, call Ethosoft customer support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  145.     END
  146.  
  147. BADPATH:
  148.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  149.     IF sz$ = "REACTIVATE" THEN
  150.         GOTO BADPATH
  151.     END IF
  152.     UIPop 1
  153.     RETURN
  154.  
  155. ASKQUIT:
  156.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  157.  
  158.     IF sz$ = "EXIT" THEN
  159.         UIPopAll
  160.         ERROR STFQUIT
  161.     ELSEIF sz$ = "REACTIVATE" THEN
  162.         GOTO ASKQUIT
  163.     ELSE
  164.         UIPop 1
  165.     END IF
  166.     RETURN
  167.  
  168. '*************************************************************************
  169. '**
  170. '** Purpose:
  171. '**     Appends a file name to the end of a directory path,
  172. '**     inserting a backslash character as needed.
  173. '** Arguments:
  174. '**     szDir$  - full directory path (with optional ending "\")
  175. '**     szFile$ - filename to append to directory
  176. '** Returns:
  177. '**     Resulting fully qualified path name.
  178. '*************************************************************************
  179. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  180.     IF szDir$ = "" THEN
  181.         MakePath = szFile$
  182.     ELSEIF szFile$ = "" THEN
  183.         MakePath = szDir$
  184.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  185.         MakePath = szDir$ + szFile$
  186.     ELSE
  187.         MakePath = szDir$ + "\" + szFile$
  188.     END IF
  189. END FUNCTION
  190.  
  191.